//
//  RegistMessageViewController.m
//  PatientApp
//
//  Created by chirui on 2017/5/17.
//  Copyright © 2017年 Shui. All rights reserved.
//

#import "RegistMessageViewController.h"


@interface RegistMessageViewController ()

{
    
    NSString * urlStr;
 
}

@property (nonatomic, strong) SZTextView *contentTextView;

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation RegistMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    self.view.backgroundColor =[UIColor whiteColor];
    
    self.navigationItem.titleView = [TopLabel withLabelWithLabelText:@"用户协议"];
    
    UIView * navView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 64)];
    navView.backgroundColor = NavBackColor;
    [self.view addSubview:navView];
    
    UILabel * label =[[UILabel alloc]initWithFrame:CGRectMake(0, 34, WIDTH, 20)];
    label.text = @"用户协议";
    label.textColor =[UIColor whiteColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont systemFontOfSize:18];
    [navView addSubview:label];
    
    UIButton * back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(10, 25, 30, 30);
    [back setBackgroundImage:ImageName(@"icon_public_return") forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    [navView addSubview:back];
    self.view.backgroundColor =[UIColor whiteColor];
    [self getNetWorking];
}

-(void)creatWebWith:(NSString *)str {
    
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,64,WIDTH, HEIGHT-64)];
    _webView.scalesPageToFit = YES;
    
    NSURL* url =[NSURL URLWithString:str];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:request];
    
    [self.view addSubview:self.webView];
    
}



// 网络请求
-(void)getNetWorking {
    
//    NSString * parametersStr = [NSString stringWithFormat:@"%@%@",address_url,regiest_messahe_api];
//
//    SHuiMBhubNoTimeLoding;
//    [PostNetWorking postNetWorkingStr:parametersStr  andparameters:nil  Success:^(id responseObject) {
//        SHuiMBHidleYes;
//        if ([responseObject[@"code"] intValue]==200) {
//            
//            urlStr = responseObject[@"datas"][@"url"];
//            [self creatWebWith:urlStr];
//            
//        } else {
//            
//            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
//        }
//        
//    } failed:^(NSError *error) {
//        SHuiMBHidleYes;
//        SHuiMBhudTextNetError;
//    }];
}

-(void)back{

    [self dismissViewControllerAnimated:YES completion:^{
        //
    }];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
